import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import ElementPlus from 'element-plus'
import router from './router'
import request from './api/request'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import i18n from '@/i18n'

// 样式
import './assets/styles/main.css'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import '@fortawesome/fontawesome-free/css/all.min.css'

const app = createApp(App)

// 注册Element Plus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 全局挂载
app.use(createPinia())
app.use(router)
app.use(ElementPlus)
app.use(i18n)

// 全局请求实例
app.config.globalProperties.$http = request

app.mount('#app')